<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="mockjs/mock-min.js"></script>
</head>
<body>
    <script>


        //获取随机的日期时间等
        console.log(Mock.Random.date());
        console.log(Mock.Random.time());
        console.log(Mock.Random.datetime());
        console.log(Mock.Random.date("yyyy年"));
        console.log(Mock.Random.date('yyyy-MM-dd'));

        //通过模板获取今天的相关信息
        console.log(Mock.Random.now());
        console.log(Mock.Random.now('year'));
        console.log(Mock.Random.now('month'));
        console.log(Mock.Random.now('minute'));

        console.log(Mock.Random.image());
        console.log(Mock.Random.image("100x100"));
        console.log(Mock.Random.image('200x100', '#4A7BF7', 'Hello'));

        //通过创建元素
        var img1=document.createElement("img");
        img1.src=Mock.Random.image("100x100");

        var img2=new Image();
        img2.src=Mock.Random.image('200x100','#4A7BF7', 'Hello');


        window.onload=function(){
            document.body.appendChild(img1);
            document.body.appendChild(img2);
        };
    </script>
</body>
</html>